﻿using RemoteSensingImageDirectServer.Models.Request.Listener;
using RemoteSensingImageDirectServer.Models.Request.Validation;
using System.ComponentModel.DataAnnotations;

namespace RemoteSensingImageDirectServer.Models.Request.Params.OGC.RasterMap
{
    public class SingleWMTSParams : IWMTSListener, IMaskListener, IImageListener, IRasterListener, ICapabilitiesListener, IStretchListener
    {
        /// <summary>
        /// 图层名称
        /// </summary>
        [Required]
        public string Layer { get; set; }

        /// <summary>
        /// 层级
        /// </summary>
        [Range(0, 23, ErrorMessage = "The TileMatrix must be between 0 and 23.")]
        public int TileMatrix { get; set; }

        /// <summary>
        /// 行
        /// </summary>
        public int TileRow { get; set; }

        /// <summary>
        /// 列
        /// </summary>
        public int TileCol { get; set; }

        /// <summary>
        /// 请求坐标系
        /// </summary>
        [EPSGValue("TileMatrixset")]
        public string TileMatrixset { get; set; } = "EPSG:4326";

        /// <summary>
        /// 掩膜文件的路径
        /// </summary>
        public string Maskfile { get; set; } = "";

        /// <summary>
        /// 样式类型
        /// </summary>
        public string Style { get; set; } = "";

        /// <summary>
        /// 背景是否透明
        /// </summary>
        public bool Transparent { get; set; } = false;

        /// <summary>
        /// 是否掩膜
        /// </summary>
        public bool IsMask { get; set; } = false;

        /// <summary>
        /// 背景色
        /// </summary>
        public string BGColor { get; set; } = "#000000";

        /// <summary>
        /// 图片格式
        /// </summary>
        [Required]
        [EnumValue("image/mixed", "image/png", "image/jpeg", "image/webp",
            ErrorMessage = "The Format value required value should be between [image/mixed,image/png,image/jpeg,image/webp].")]
        public string Format { get; set; } = "image/jpeg";

        /// <summary>
        /// 波段排列顺序
        /// </summary>
        public int[] Bands { get; set; } = { 3, 2, 1 };

        /// <summary>
        /// 影像数据源是否是全路径
        /// </summary>
        public bool IsFullPath { get; set; } = true;

        /// <summary>
        /// 服务类型
        /// </summary>
        [Required]
        [EnumValue("wmts",
            ErrorMessage = "The Service value required value should be between [WMTS].")]
        public string Service { get; set; } = "WMTS";

        /// <summary>
        /// 请求类型
        /// </summary>
        [Required]
        [EnumValue("getcapabilities", "gettile",
            ErrorMessage = "The Request value required value should be between [GetCapabilities,GetTile].")]
        public string Request { get; set; } = "GetCapabilities";

        /// <summary>
        /// 版本号
        /// </summary>
        [Required]
        [EnumValue("1.0.0",
            ErrorMessage = "The Version value required value should be between [1.0.0].")]
        public string Version { get; set; } = "1.0.0";

        /// <summary>
        /// 坐标系
        /// </summary>
        [EPSGValue("Srs")]
        public string Srs { get; set; } = "EPSG:4326";

        /// <summary>
        /// 最大百分比拉伸(左)
        /// </summary>
        [Range(0d, 49.9d, ErrorMessage = "The PercentLeft must be between 0d and 49.9d.")]
        public double PercentLeft { get; set; } = 0;

        /// <summary>
        /// 最大百分比拉伸(右)
        /// </summary>
        [Range(0d, 49.9d, ErrorMessage = "The PercentRight must be between 0d and 49.9d.")]
        public double PercentRight { get; set; } = 0;

        /// <summary>
        /// Gamma拉伸
        /// </summary>
        [Range(0d, 2d, ErrorMessage = "The Gamma must be between 0d and 2d.")]
        public double Gamma { get; set; } = 0.8;
    }
}
